// subscribe.js
// Work together with ../background/subscribe.js. When a subscribed page is
// visited, notify the background page so that don't show notifications for
// it again.
var posts = document.getElementsByClassName("t5");
if(posts.length)
{
	var a = posts[posts.length - 1].previousElementSibling;
	if(a.tagName.toLowerCase() == "a")
	{
		var postUrl = (location.href.match(
			/http:\/\/.*?(\/read\.php\?tid=\d+)/) || [])[1];
		(chrome.extension.sendMessage || chrome.extension.sendRequest)(
			{name: "updateSubscription", type: "replies", 
			url: postUrl, lastPost: a.name});
	}
}

